package com.chongjing.web.controller.chat;
import com.chongjing.chat.domain.MessageConditionData;
import com.chongjing.chat.domain.OverviewData;
import com.chongjing.chat.service.IStatisticsService;
import com.chongjing.common.annotation.DataSource;
import com.chongjing.common.core.controller.BaseController;
import com.chongjing.common.core.domain.AjaxResult;
import com.chongjing.common.enums.DataSourceType;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@Slf4j
@RestController
@RequestMapping("/chat")
@DataSource(DataSourceType.SLAVE) //这样，执行该方法的时候就会选择SLAVE数据源
public class StatisticsController extends BaseController {
    @Autowired
    private IStatisticsService iStatisticsService;

    @GetMapping("/overview")
    public AjaxResult getOverviewData(MessageConditionData messageConditionData) {
        // 根据时间条件查询消息概览数据
        OverviewData overviewData = iStatisticsService.getOverviewData(messageConditionData);
        return success(overviewData);
    }



}
